package Wuyujie;

import java.util.Scanner;
public class Text1 {
    private String name;
    private String sex;


    public Text1(String name, String sex) {
        this.name = name;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }



    public static void main(String[] args) {

        int[] a = new int[5];

        Scanner sc = new Scanner(System.in);
        for (int i = 0; i <a.length ; i++) {
            System.out.println("请输入第"+(i+1)+"个元素");
            a[i] = sc.nextInt();
        }
        System.out.println("数组的元素为:");
        for (int i = 0; i < a.length ; i++) {
            System.out.println(a[i]+" ");
        }
        int sum =0;
        for (int i = 0; i <a.length ; i++) {
            sum += a[i];
        }
        System.out.println("总和为"+sum);
    }




}
